import request from '@/utils/request'

export function getCategoryList (params) {
  return request({
    url: '/category/page',
    method: 'get',
    // 以查询字符串的方式
    params
  })
}

// 获取某个 type (菜品或套餐)的分类列表
// 菜品为1，套餐为2
// /category/list?type=__
export function getCategoryByType (params) {
  return request({
    url: '/category/list',
    method: 'get',
    params
  })
}

// 新增(菜品或套餐)分类
export function addCategory (data) {
  return request({
    url: '/category',
    method: 'post',
    data
  })
}

// 修改(菜品或套餐)分类
export function editCategory (data) {
  return request({
    url: '/category',
    method: 'put',
    data
  })
}

export function delCategory (params) {
  return request({
    url: '/category',
    method: 'delete',
    params
  })
}
